<!doctype html>
<html lang="zh-Hans" dir="ltr" class="docs-wrapper docs-doc-page docs-version-current plugin-docs plugin-id-default docs-doc-id-middleware-sources/desktop-test">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="generator" content="Docusaurus v2.0.1">
<link rel="search" type="application/opensearchdescription+xml" title="Knife4j" href="/opensearch.xml">

<!-- Google Tag Manager -->
    <script>!function(e,t,a,n,g){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var m=t.getElementsByTagName(a)[0],r=t.createElement(a);r.async=!0,r.src="https://www.googletagmanager.com/gtm.js?id=GTM-TKBX678",m.parentNode.insertBefore(r,m)}(window,document,"script","dataLayer")</script>
    <!-- End Google Tag Manager -->
<script src="/js/custom.js"></script>
<script src="/js/baidu.js"></script>
<script src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-1589206801610969" async crossorigin="anonymous"></script><title data-rh="true">2.4 测试场景 | Knife4j</title><meta data-rh="true" name="twitter:card" content="summary_large_image"><meta data-rh="true" property="og:url" content="https://doc.xiaominfo.com/docs/middleware-sources/desktop-test"><meta data-rh="true" name="docusaurus_locale" content="zh-Hans"><meta data-rh="true" name="docsearch:language" content="zh-Hans"><meta data-rh="true" name="docusaurus_version" content="current"><meta data-rh="true" name="docusaurus_tag" content="docs-default-current"><meta data-rh="true" name="docsearch:version" content="current"><meta data-rh="true" name="docsearch:docusaurus_tag" content="docs-default-current"><meta data-rh="true" property="og:title" content="2.4 测试场景 | Knife4j"><meta data-rh="true" name="description" content="快速了解Swagger2以及OpenAPI3规范"><meta data-rh="true" property="og:description" content="快速了解Swagger2以及OpenAPI3规范"><link data-rh="true" rel="icon" href="/img/favicon.ico"><link data-rh="true" rel="canonical" href="https://doc.xiaominfo.com/docs/middleware-sources/desktop-test"><link data-rh="true" rel="alternate" href="https://doc.xiaominfo.com/docs/middleware-sources/desktop-test" hreflang="zh-Hans"><link data-rh="true" rel="alternate" href="https://doc.xiaominfo.com/docs/middleware-sources/desktop-test" hreflang="x-default"><link data-rh="true" rel="preconnect" href="https://3CRIMRK623-dsn.algolia.net" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.66359a73.css">
<link rel="preload" href="/assets/js/runtime~main.e0db172c.js" as="script">
<link rel="preload" href="/assets/js/main.c059fb6e.js" as="script">
</head>
<body class="navigation-with-keyboard">
<script>!function(){function e(e){document.documentElement.setAttribute("data-theme",e)}var t=function(){var e=null;try{e=localStorage.getItem("theme")}catch(e){}return e}();null!==t?e(t):window.matchMedia("(prefers-color-scheme: dark)").matches?e("dark"):window.matchMedia("(prefers-color-scheme: light)").matches?e("light"):e("dark")}()</script><div id="__docusaurus">
<div role="region"><a href="#" class="skipToContent_fXgn">跳到主要内容</a></div><nav class="navbar navbar--fixed-top navbarHideable_m1mJ"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Navigation bar toggle" class="navbar__toggle clean-btn" type="button" tabindex="0"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="/img/knife4j-light.svg" alt="" class="themedImage_ToTc themedImage--light_HNdA"><img src="/img/knife4j-dark.svg" alt="" class="themedImage_ToTc themedImage--dark_i4oU"></div><b class="navbar__title text--truncate">Knife4j</b></a><a class="navbar__item navbar__link" href="/docs/quick-start">文档</a><a aria-current="page" class="navbar__item navbar__link changelog navbar__link--active" href="/docs/middleware-sources">中间件</a><a class="navbar__item navbar__link changelog" href="/docs/oas">OAS规范</a><a class="navbar__item navbar__link changelog" href="/docs/action">实战指南</a><a class="navbar__item navbar__link changelog" href="/docs/changelog">更新日志</a><a class="navbar__item navbar__link changelog" href="/docs/faq">FAQ</a><div class="navbar__item dropdown dropdown--hoverable"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">旧版本</a><ul class="dropdown__menu"><li><a class="dropdown__link" target="_blank" href="/v2/index.html">2.0.9</a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="toggle_MW0i colorModeToggle_x44X"><button class="clean-btn toggleButton_yw5v toggleButtonDisabled_BJd7" type="button" disabled="" title="切换浅色/暗黑模式（当前为暗黑模式）" aria-label="切换浅色/暗黑模式（当前为暗黑模式）"><span><svg viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg" width="14" height="14" class="lightToggleIcon_SFTY"><g clip-path="url(#clip0_833_8168)"><path d="M6.59998 8.49999C7.98069 8.49999 9.09998 7.3807 9.09998 5.99999C9.09998 4.61928 7.98069 3.49999 6.59998 3.49999C5.21926 3.49999 4.09998 4.61928 4.09998 5.99999C4.09998 7.3807 5.21926 8.49999 6.59998 8.49999Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 0.5V1.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.59985 10.5V11.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 2.11L3.4199 2.82" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 9.17999L10.4899 9.88999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.09998 6H2.09998" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11.0999 6H12.0999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M2.7099 9.88999L3.4199 9.17999" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9.77991 2.82L10.4899 2.11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path></g><defs><clipPath id="clip0_833_8168"><rect width="12" height="12" fill="white" transform="translate(0.599976)"></rect></clipPath></defs></svg><svg viewBox="0 0 13 12" width="14" height="14" class="darkToggleIcon_ekgs"><path d="M10.7001 6.39501C10.6215 7.24611 10.3021 8.05721 9.77927 8.7334C9.25646 9.40959 8.55189 9.92291 7.748 10.2133C6.9441 10.5036 6.07414 10.5591 5.2399 10.3731C4.40565 10.187 3.64164 9.76728 3.03726 9.1629C2.43287 8.55851 2.01312 7.7945 1.8271 6.96026C1.64108 6.12602 1.6965 5.25605 1.98688 4.45216C2.27725 3.64826 2.79056 2.94369 3.46675 2.42088C4.14294 1.89808 4.95404 1.57866 5.80515 1.50001C5.30685 2.17414 5.06707 3.00473 5.12941 3.84071C5.19175 4.6767 5.55208 5.46254 6.14485 6.05531C6.73762 6.64808 7.52346 7.0084 8.35944 7.07074C9.19542 7.13308 10.026 6.8933 10.7001 6.39501Z" stroke="currentColor" fill="transparent" stroke-linecap="round" stroke-linejoin="round"></path></svg></span></button></div><a href="https://github.com/xiaoymin/swagger-bootstrap-ui" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link icon" title="View on GitHub">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="searchBox_ZlJk"><button type="button" class="DocSearch DocSearch-Button" aria-label="搜索"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">搜索</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div class="main-wrapper mainWrapper_z2l0 docsWrapper_BCFX"><button aria-label="回到顶部" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><main class="docMainContainer_gTbr docMainContainerEnhanced_Uz_u"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_z5aJ"><div class="docItemContainer_c0TR"><article><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">本页总览</button></div><div class="theme-doc-markdown markdown"><h1>2.4 测试场景</h1><p>本文主要包含作者对<code>Knife4jAggregationDesktop</code>的测试场景,主要包含支持的四种模式进行分别测试,仅供使用者进行参考</p><blockquote><p><strong>注意</strong>:以下测试场景无需重启服务</p></blockquote><h2 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="231-disk模式">2.3.1 Disk模式<a class="hash-link" href="#231-disk模式" title="标题的直接链接">​</a></h2><blockquote><p><a href="https://www.bilibili.com/video/BV1XA411s73b/" target="_blank" rel="noopener">视频介绍-Knife4jAggregationDesktop使用-Disk模式</a></p></blockquote><p>1、在<code>data</code>目录下新增文件夹并且修改符合Desktop要求的名称格式，直接放入OpenAPI规范的静态JSON文件，不重启的情况下渲染正常(<strong>正常</strong>)</p><p>2、修改某个文件夹下的OpenAPI规范静态JSON文件,不重启的情况下等待5s后刷新文档是否变更(<strong>正常</strong>)</p><p>3、为disk模式创建<code>disk.properties</code>,为disk模式配置服务的重命名是否生效(<strong>正常</strong>)</p><p>4、修改<code>disk.properties</code>配置文件，修改服务的名称显示是否生效(<strong>正常</strong>)</p><p>5、修改<code>disk.properties</code>配置文件,为服务配置<code>host</code>开启调试功能，调试是否生效(<strong>正常</strong>)</p><div class="language-properties codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-properties codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.disk.routes[0].name=测试平台</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.disk.routes[0].host=http://knife4j.xiaominfo.com</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.disk.routes[0].location=test.json</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="复制代码到剪贴板" title="复制" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>6、修改<code>disk.properties</code>配置文件,取消调试配置<code>host</code>的属性，调试是否失效(<strong>正常</strong>)</p><p>7、删除<code>disk.properties</code>配置文件，刷新是否正常(<strong>正常</strong>)</p><p>8、修改<code>disk.properties</code>配置文件，配置<code>basicAuth</code>以开启文档保护策略，是否生效(<strong>正常</strong>)</p><div class="language-properties codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-properties codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.basicAuth.enable=true</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.basicAuth.username=zhangsan</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.basicAuth.password=123456</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="复制代码到剪贴板" title="复制" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>9、修改<code>disk.properties</code>配置文件，配置<code>basicAuth</code>以开启文档保护策略后，访问其他项目的文档是否无影响能正常访问(<strong>正常</strong>)</p><p>10、修改<code>disk.properties</code>配置文件，删除<code>basicAuth</code>去除文档的保护策略，是否生效(<strong>正常</strong>)</p><p>11、修改<code>disk.properties</code>配置文件，为<code>routes</code>节点配置<code>servicePath</code>属性，是否能正常渲染及调试(<strong>正常</strong>)</p><div class="language-properties codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-properties codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.disk.routes[0].name=测试平台</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.disk.routes[0].host=http://knife4j.xiaominfo.com</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.disk.routes[0].location=test.json</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.disk.routes[0].servicePath=/niubia</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="复制代码到剪贴板" title="复制" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>12、在<code>data</code>目录下新增文件夹并且修改符合Desktop要求的名称格式，直接放入OpenAPI规范的静态<code>yml</code>文件，是否渲染正常(<strong>正常</strong>)</p><p>13、按规定放入<code>yml</code>及<code>json</code>两种OpenAPI规范的静态文件，是否渲染正常(<strong>正常</strong>)</p><p>14、创建<code>disk.properties</code>配置文件,对于yml和json两种格式的文件进行重命名配置,是否渲染生效(<strong>正常</strong>)</p><div class="language-properties codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-properties codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.disk.routes[0].name=yml格式</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.disk.routes[0].location=33.yml</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.disk.routes[0].order=1</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.disk.routes[1].name=json格式</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.disk.routes[1].location=DolphinScheduler.json</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.disk.routes[1].order=2</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="复制代码到剪贴板" title="复制" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>供参考示例配置<code>disk.properties</code>:</p><div class="language-properties codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-properties codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.disk.routes[0].name=测试平台</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.disk.routes[0].host=http://knife4j.xiaominfo.com</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.disk.routes[0].location=test.json</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.disk.routes[0].servicePath=/niubia</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.disk.routes[1].name=用户体系</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.disk.routes[1].host=http://knife4j.xiaominfo.com</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.disk.routes[1].location=user.json</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">#knife4j.basicAuth.enable=true</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">#knife4j.basicAuth.username=zhangsan</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">#knife4j.basicAuth.password=123456</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="复制代码到剪贴板" title="复制" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="232-cloud模式">2.3.2 Cloud模式<a class="hash-link" href="#232-cloud模式" title="标题的直接链接">​</a></h2><blockquote><p><a href="https://www.bilibili.com/video/BV14y4y1i7nu/" target="_blank" rel="noopener">视频介绍-Knife4jAggregationDesktop使用-Cloud模式</a></p></blockquote><p>1、在<code>data</code>目录下新增文件夹并且修改符合Desktop要求的名称格式，新建<code>cloud.properties</code>配置文件及配置，是否生效(<strong>正常</strong>)</p><div class="language-properties codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-properties codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.cloud.routes[0].name=大数据平台1</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.cloud.routes[0].location=/v2/api-docs?group=3.默认接口</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.cloud.routes[0].uri=http://knife4j.xiaominfo.com</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.cloud.routes[1].name=甄选平台</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.cloud.routes[1].location=/v2/api-docs?group=2.X版本</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.cloud.routes[1].uri=http://knife4j.xiaominfo.com</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="复制代码到剪贴板" title="复制" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>2、修改<code>cloud.properties</code>配置文件，增加排序字段，排序(正序)是否生效(<strong>正常</strong>)</p><div class="language-properties codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-properties codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.cloud.routes[0].name=大数据平台1</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.cloud.routes[0].order=1</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.cloud.routes[0].location=/v2/api-docs?group=3.默认接口</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.cloud.routes[0].uri=http://knife4j.xiaominfo.com</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.cloud.routes[1].name=甄选平台</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.cloud.routes[1].order=2</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.cloud.routes[1].location=/v2/api-docs?group=2.X版本</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.cloud.routes[1].uri=http://knife4j.xiaominfo.com</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="复制代码到剪贴板" title="复制" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>3、调试是否正常(<strong>正常</strong>)</p><p>4、修改<code>cloud.properties</code>配置文件，配置<code>basicAuth</code>以开启文档保护策略，是否生效(<strong>正常</strong>)</p><div class="language-properties codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-properties codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.basicAuth.enable=true</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.basicAuth.username=cloud</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.basicAuth.password=123456</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="复制代码到剪贴板" title="复制" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>5、修改<code>cloud.properties</code>配置文件，配置<code>basicAuth</code>以开启文档保护策略后，访问其他项目的文档是否无影响能正常访问(<strong>正常</strong>)</p><p>6、修改<code>cloud.properties</code>配置文件，删除<code>basicAuth</code>去除文档的保护策略，是否生效(<strong>正常</strong>)</p><p>7、修改<code>cloud.properties</code>配置文件，为<code>routes</code>节点配置<code>servicePath</code>属性，是否能正常渲染及调试(<strong>正常</strong>)</p><p>参考示例配置<code>cloud.properties</code>:</p><div class="language-properties codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-properties codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.cloud.routes[0].name=大数据平台1</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.cloud.routes[0].order=12</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.cloud.routes[0].location=/v2/api-docs?group=3.默认接口</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.cloud.routes[0].uri=http://knife4j.xiaominfo.com</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">#knife4j.cloud.routes[0].servicePath=/niub</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.cloud.routes[1].name=甄选平台</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.cloud.routes[1].order=2</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.cloud.routes[1].location=/v2/api-docs?group=2.X版本</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.cloud.routes[1].uri=http://knife4j.xiaominfo.com</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">#knife4j.cloud.routes[1].servicePath=/cloud</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">#knife4j.basicAuth.enable=true</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">#knife4j.basicAuth.username=cloud</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">#knife4j.basicAuth.password=123456</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="复制代码到剪贴板" title="复制" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="233-eureka模式">2.3.3 Eureka模式<a class="hash-link" href="#233-eureka模式" title="标题的直接链接">​</a></h2><blockquote><p><a href="https://www.bilibili.com/video/BV1Cy4y1i7B5/" target="_blank" rel="noopener">视频介绍-Knife4jAggregationDesktop使用-Eureka模式</a></p></blockquote><p>1、在<code>data</code>目录下新增文件夹并且修改符合Desktop要求的名称格式，新建<code>eureka.properties</code>配置文件及配置，是否生效(<strong>正常</strong>)</p><div class="language-properties codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-properties codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.eureka.serviceUrl=http://localhost:10000/eureka/</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.eureka.routes[0].name=用户服务asdf</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.eureka.routes[0].serviceName=service-user</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.eureka.routes[0].location=/aub/v2/api-docs?group=default</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.eureka.routes[1].name=订单服务2ff</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.eureka.routes[1].serviceName=service-order</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.eureka.routes[1].location=/v2/api-docs?group=default</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="复制代码到剪贴板" title="复制" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>2、修改<code>eureka.properties</code>配置文件，增加order属性修改分组显示顺序，是否正常(<strong>正常</strong>)</p><div class="language-properties codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-properties codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.eureka.serviceUrl=http://localhost:10000/eureka/</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.eureka.routes[0].name=用户服务asdf</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.eureka.routes[0].serviceName=service-user</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.eureka.routes[0].location=/aub/v2/api-docs?group=default</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.eureka.routes[0].order=1</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.eureka.routes[1].name=订单服务2ff</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.eureka.routes[1].serviceName=service-order</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.eureka.routes[1].location=/v2/api-docs?group=default</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.eureka.routes[1].order=2</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="复制代码到剪贴板" title="复制" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>3、修改<code>eureka.properties</code>配置文件，修改服务的显示名称<code>name</code>,文档界面是否正常显示(<strong>正常</strong>)</p><div class="language-properties codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-properties codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.eureka.serviceUrl=http://localhost:10000/eureka/</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.eureka.routes[0].name=自定义服务1</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.eureka.routes[0].serviceName=service-user</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.eureka.routes[0].location=/aub/v2/api-docs?group=default</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.eureka.routes[0].order=1</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.eureka.routes[1].name=自定义服务2</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.eureka.routes[1].serviceName=service-order</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.eureka.routes[1].location=/v2/api-docs?group=default</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.eureka.routes[1].order=2</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="复制代码到剪贴板" title="复制" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>4、调试是否正常(<strong>正常</strong>)</p><p>5、修改<code>eureka.properties</code>配置文件,增加Basic权限控制，访问该文档需要输入用户名及密码，是否正常显示(<strong>正常</strong>)</p><div class="language-properties codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-properties codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.eureka.serviceUrl=http://localhost:10000/eureka/</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.eureka.routes[0].name=自定义服务1</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.eureka.routes[0].serviceName=service-user</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.eureka.routes[0].location=/aub/v2/api-docs?group=default</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.eureka.routes[0].order=1</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.eureka.routes[1].name=自定义服务2</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.eureka.routes[1].serviceName=service-order</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.eureka.routes[1].location=/v2/api-docs?group=default</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.eureka.routes[1].order=2</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.basicAuth.enable=true</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.basicAuth.username=abc</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.basicAuth.password=123456</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="复制代码到剪贴板" title="复制" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>6、修改<code>eureka.properties</code>配置文件，去除basic权限控制，访问文档是否正常(<strong>正常</strong>)</p><div class="language-properties codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-properties codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.eureka.serviceUrl=http://localhost:10000/eureka/</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.eureka.routes[0].name=自定义服务1</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.eureka.routes[0].serviceName=service-user</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.eureka.routes[0].location=/aub/v2/api-docs?group=default</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.eureka.routes[0].order=1</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.eureka.routes[1].name=自定义服务2</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.eureka.routes[1].serviceName=service-order</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.eureka.routes[1].location=/v2/api-docs?group=default</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.eureka.routes[1].order=2</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"># 可以改为false，或者把下面的配置全部注释，两种方式都行</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.basicAuth.enable=false</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.basicAuth.username=abc</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.basicAuth.password=123456</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="复制代码到剪贴板" title="复制" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>7、删除<code>eureka.properties</code>配置文件，文档是否还能访问(<strong>正常</strong>)</p><h2 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="234-nacos模式">2.3.4 Nacos模式<a class="hash-link" href="#234-nacos模式" title="标题的直接链接">​</a></h2><blockquote><p><a href="https://www.bilibili.com/video/BV1zh411f7pz/" target="_blank" rel="noopener">视频介绍-Knife4jAggregationDesktop使用-Nacos模式</a></p></blockquote><p>1、在<code>data</code>目录下新增文件夹并且修改符合Desktop要求的名称格式，新建<code>nacos.properties</code>配置文件及配置，是否生效(<strong>正常</strong>)</p><div class="language-properties codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-properties codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.nacos.serviceUrl=http://192.168.0.223:8848/nacos</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.nacos.routes[0].name=自定义服务1</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.nacos.routes[0].serviceName=service-user</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.nacos.routes[0].location=/v2/api-docs?group=default</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.nacos.routes[1].name=自定义服务2</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.nacos.routes[1].serviceName=service-order</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.nacos.routes[1].location=/v2/api-docs?group=default</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="复制代码到剪贴板" title="复制" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>2、修改<code>nacos.properties</code>配置文件，增加order属性修改分组显示顺序，是否正常(<strong>正常</strong>)</p><div class="language-properties codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-properties codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.nacos.serviceUrl=http://192.168.0.223:8848/nacos</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.nacos.routes[0].name=自定义服务1</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.nacos.routes[0].serviceName=service-user</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.nacos.routes[0].location=/v2/api-docs?group=default</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.nacos.routes[0].order=3</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.nacos.routes[1].name=自定义服务2</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.nacos.routes[1].serviceName=service-order</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.nacos.routes[1].location=/v2/api-docs?group=default</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.nacos.routes[1].order=2</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="复制代码到剪贴板" title="复制" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>3、修改<code>nacos.properties</code>配置文件，修改服务的显示名称<code>name</code>,文档界面是否正常显示(<strong>正常</strong>)</p><div class="language-properties codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-properties codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.nacos.serviceUrl=http://192.168.0.223:8848/nacos</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.nacos.routes[0].name=自定义X服务1</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.nacos.routes[0].serviceName=service-user</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.nacos.routes[0].location=/v2/api-docs?group=default</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.nacos.routes[0].order=3</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.nacos.routes[1].name=自定义X服务2</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.nacos.routes[1].serviceName=service-order</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.nacos.routes[1].location=/v2/api-docs?group=default</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.nacos.routes[1].order=2</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="复制代码到剪贴板" title="复制" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>4、调试是否正常(<strong>正常</strong>)</p><p>5、修改<code>nacos.properties</code>配置文件,增加Basic权限控制，访问该文档需要输入用户名及密码，是否正常显示(<strong>正常</strong>)</p><div class="language-properties codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-properties codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.nacos.serviceUrl=http://192.168.0.223:8848/nacos</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.nacos.routes[0].name=自定义X服务1</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.nacos.routes[0].serviceName=service-user</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.nacos.routes[0].location=/v2/api-docs?group=default</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.nacos.routes[0].order=3</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.nacos.routes[1].name=自定义X服务2</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.nacos.routes[1].serviceName=service-order</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.nacos.routes[1].location=/v2/api-docs?group=default</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.nacos.routes[1].order=2</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.basicAuth.enable=true</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.basicAuth.username=nacos</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.basicAuth.password=1234</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="复制代码到剪贴板" title="复制" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>6、修改<code>nacos.properties</code>配置文件，去除basic权限控制，访问文档是否正常(<strong>正常</strong>)</p><div class="language-properties codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-properties codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.nacos.serviceUrl=http://192.168.0.223:8848/nacos</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.nacos.routes[0].name=自定义X服务1</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.nacos.routes[0].serviceName=service-user</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.nacos.routes[0].location=/v2/api-docs?group=default</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.nacos.routes[0].order=3</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.nacos.routes[1].name=自定义X服务2</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.nacos.routes[1].serviceName=service-order</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.nacos.routes[1].location=/v2/api-docs?group=default</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.nacos.routes[1].order=2</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"># 可以改为false，或者把下面的配置全部注释，两种方式都行</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.basicAuth.enable=false</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.basicAuth.username=nacos</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.basicAuth.password=1234</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="复制代码到剪贴板" title="复制" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>7、Nacos注册中心开启了权限验证,在<code>nacos.properties</code>配置文件中进行配置，测试文档聚合是否正常(<strong>正常</strong>)</p><div class="language-properties codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-properties codeBlock_bY9V thin-scrollbar"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.nacos.serviceUrl=http://192.168.0.223:8848/nacos</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"># Nacos OpenAPI权限</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.nacos.serviceAuth.enable=true</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.nacos.serviceAuth.username=nacos</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.nacos.serviceAuth.password=nacos</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.nacos.routes[0].name=自定义X服务1</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.nacos.routes[0].serviceName=service-user</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.nacos.routes[0].location=/v2/api-docs?group=default</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.nacos.routes[0].order=3</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.nacos.routes[1].name=自定义X服务2</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.nacos.routes[1].serviceName=service-order</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.nacos.routes[1].location=/v2/api-docs?group=default</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.nacos.routes[1].order=2</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"># 可以改为false，或者把下面的配置全部注释，两种方式都行</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.basicAuth.enable=false</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.basicAuth.username=nacos</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">knife4j.basicAuth.password=1234</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="复制代码到剪贴板" title="复制" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg class="copyButtonIcon_y97N" viewBox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg class="copyButtonSuccessIcon_LjdS" viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>8、删除<code>nacos.properties</code>配置文件，文档是否还能访问(<strong>正常</strong>)</p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"></div><div class="col lastUpdated_vwxv"><span class="theme-last-updated">最后<!-- -->由 <b>xiaoyumin</b> <!-- -->于 <b><time datetime="2022-08-14T10:05:39.000Z">2022年8月14日</time></b> <!-- -->更新</span></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="文档分页导航"></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#231-disk模式" class="table-of-contents__link toc-highlight">2.3.1 Disk模式</a></li><li><a href="#232-cloud模式" class="table-of-contents__link toc-highlight">2.3.2 Cloud模式</a></li><li><a href="#233-eureka模式" class="table-of-contents__link toc-highlight">2.3.3 Eureka模式</a></li><li><a href="#234-nacos模式" class="table-of-contents__link toc-highlight">2.3.4 Nacos模式</a></li></ul></div></div></div></div></main></div></div><footer class="footer"><div class="container container-fluid"><div class="row footer__links"><div class="col footer__col"><div class="footer__title">文档指南</div><ul class="footer__items clean-list"><li class="footer__item"><a class="footer__link-item" href="/docs/quick-start">文档</a></li><li class="footer__item"><a class="footer__link-item" href="/docs/community/simple-demo">示例</a></li><li class="footer__item"><a class="footer__link-item" href="/docs/changelog">更新日志</a></li><li class="footer__item"><a class="footer__link-item" href="/docs/upgrading/upgrading-to-v4">升级到v4.0</a></li></ul></div><div class="col footer__col"><div class="footer__title">社区</div><ul class="footer__items clean-list"><li class="footer__item"><a href="https://gitter.im/knife4j/knife4j" target="_blank" rel="noopener noreferrer" class="footer__link-item">Gitter<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li class="footer__item"><a href="https://www.oschina.net/question/tag/swagger-bootstrap-ui" target="_blank" rel="noopener noreferrer" class="footer__link-item">开源中国<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><div class="col footer__col"><div class="footer__title">关注公众号</div><ul class="footer__items clean-list"><li class="footer__item"><img src="/images/website/qrcode.jpg" width="150"></li></ul></div><div class="col footer__col"><div class="footer__title">更多</div><ul class="footer__items clean-list"><li class="footer__item"><a href="https://docusaurus.io" target="_blank" rel="noopener noreferrer" class="footer__link-item">Docusaurus<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li class="footer__item"><a href="https://gitee.com/xiaoym/knife4j" target="_blank" rel="noopener noreferrer" class="footer__link-item">Gitee<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li class="footer__item"><a href="https://github.com/xiaoymin/swagger-bootstrap-ui" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div></div><div class="footer__bottom text--center"><div class="footer__copyright">Apache License 2.0 | Copyright © 2018-2023-八一菜刀 浙ICP备18027673号-1 </div></div></div></footer></div>
<script src="/assets/js/runtime~main.e0db172c.js"></script>
<script src="/assets/js/main.c059fb6e.js"></script>
<!-- Google Tag Manager (noscript) -->
    <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-TKBX678" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
    <!-- End Google Tag Manager (noscript) --></body>
</html>